* NOTE: You need to set the Stata working directory to the path
* where the data file is located.

set more off

clear
quietly infix                 ///
  str     year       1-4      ///
  str     regiona    5-5      ///
  str     divisiona  6-6      ///
  str     state      7-30     ///
  str     statea     31-32    ///
  str     smsaa      33-36    ///
  str     county     37-93    ///
  str     countya    94-96    ///
  str     cty_suba   97-99    ///
  str     placea     100-103  ///
  str     tracta     104-109  ///
  str     blck_grpa  110-110  ///
  str     enumdista  111-111  ///
  str     scsaa      112-113  ///
  str     urb_areaa  114-117  ///
  str     cda        118-119  ///
  str     aianhha    120-122  ///
  str     mcdseqnoa  123-126  ///
  str     zipa       127-131  ///
  str     areaname   132-191  ///
  double  dhm001     192-200  ///
  double  dhm002     201-209  ///
  double  dhm003     210-218  ///
  double  dhm004     219-227  ///
  double  dhm005     228-236  ///
  double  dil001     237-245  ///
  double  div001     246-254  ///
  double  di8001     255-263  ///
  double  di8002     264-272  ///
  double  djd001     273-281  ///
  double  djd002     282-290  ///
  double  djd003     291-299  ///
  double  djd004     300-308  ///
  double  djd005     309-317  ///
  using `"nhgis0017_ds107_1980_county.dat"'


format dhm001    %9.0f
format dhm002    %9.0f
format dhm003    %9.0f
format dhm004    %9.0f
format dhm005    %9.0f
format dil001    %9.0f
format div001    %9.0f
format di8001    %9.0f
format di8002    %9.0f
format djd001    %9.0f
format djd002    %9.0f
format djd003    %9.0f
format djd004    %9.0f
format djd005    %9.0f

label var year      `"Data File Year"'
label var regiona   `"Region Code"'
label var divisiona `"Division Code"'
label var state     `"State Name"'
label var statea    `"State Code"'
label var smsaa     `"Standard Metropolitan Statistical Area Code"'
label var county    `"County Name"'
label var countya   `"County Code"'
label var cty_suba  `"County Subdivision Code"'
label var placea    `"Place Code"'
label var tracta    `"Census Tract Code"'
label var blck_grpa `"Block Group Code"'
label var enumdista `"Enumeration District Code"'
label var scsaa     `"Standard Consolidated Statistical Area Code"'
label var urb_areaa `"Urban Area Code"'
label var cda       `"Congressional District Code"'
label var aianhha   `"American Indian Area/Alaska Native Area/Hawaiian Home Land Code"'
label var mcdseqnoa `"MCD Sequence Number Code"'
label var zipa      `"5-Digit Zip Code Code"'
label var areaname  `"Area Name"'
label var dhm001    `"Elementary (0-8 years)"'
label var dhm002    `"High school: 1-3 years"'
label var dhm003    `"High school: 4 years"'
label var dhm004    `"College: 1-3 years"'
label var dhm005    `"College: 4 or more years"'
label var dil001    `"Median family income in 1979"'
label var div001    `"Median income in 1979"'
label var di8001    `"Income above poverty level"'
label var di8002    `"Income below poverty level"'
label var djd001    `"Income in 1979 below 75 percent of poverty level"'
label var djd002    `"Income in 1979 between 75 and 124 percent of poverty level"'
label var djd003    `"Income in 1979 between 125 and 149 of poverty level"'
label var djd004    `"Income in 1979 between 150 and 199 of poverty level"'
label var djd005    `"Income in 1979 200 percent of poverty level and above"'


